#include "smart-device-manager.h"

int main(int argc, char const *argv[])
{
	string             uartDevice = "/dev/ttyS0";
	SmartDeviceManager deviceManager(uartDevice);

#if 0
	bool               ok = deviceManager.openDoorlock(0x00, 0x01);
	cout << "open doorlock ok:" << ok << endl;

	ok = deviceManager.closeDoorlock(0x00, 0x01);
	cout << "close doorlock ok:" << ok << endl;

	uint8_t lockStatu = 0;
	ok                = deviceManager.queryDoorlock(0x00, 0x01, lockStatu);
	cout << "query doorlock ok:" << ok << endl;
	cout << "query doorlock lockStatu:" << lockStatu << endl;

	uint16_t temp;
	bool     ok = deviceManager.querySensor(0x00, 0x00, temp);
	cout << "query querySensor ok:" << ok << endl;
	cout << "query querySensor temp data:" << temp << endl;
#endif
	vector<uint8_t> info;
	bool            ok = deviceManager.sniffingDevice(0x02, 0x00, info);
	cout << "query querySensor ok:" << ok << endl;
	if(ok)
	{
		for(int i = 0; i < info.size(); i++)
		{
			printf("%02x", info[i]);
		}
		printf("\n");
	}
	return 0;
}
